package com.xuecheng.content.controller;

import com.xuecheng.api.content.CourseAuditApl;
import com.xuecheng.api.content.model.CourseBaseDTO;
import com.xuecheng.api.content.model.qo.CourseAuditVO;
import com.xuecheng.api.content.model.qo.QueryCourseModel;
import com.xuecheng.common.domain.page.PageRequestParams;
import com.xuecheng.common.domain.page.PageVO;
import com.xuecheng.content.service.CourseBaseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * <h4>xuecheng</h4>
 * <p>运营平台审核</p>
 *
 * @author : by wujianming
 * @date : 2021-12-13 18:08
 **/
@Slf4j
@RestController
public class CourseAuditController implements CourseAuditApl {

    //运营平台标识..查询所有机构的课程
    public static final Long COMPAIND=-99999999L;
    @Autowired
    private CourseBaseService courseBaseService;


    //分页查询运营审核科目
    @Override
    @PostMapping("m/course/list")
    public PageVO<CourseBaseDTO> queryCourseList(PageRequestParams params, @RequestBody QueryCourseModel model) {

        return courseBaseService.queryCourseList(params, model,COMPAIND);
    }

    //课程审核--已提交课程才能审核
    @Override
    @PostMapping("m/courseReview/approve")
    public void approveCourse(@RequestBody CourseAuditVO auditVO) {

//        CourseBaseDTO dto = CourseBaseConvert.INSTANCE.voa2DTO(auditVO);
        CourseBaseDTO courseBaseDTO = new CourseBaseDTO();
        courseBaseDTO.setCourseBaseId(auditVO.getCourseBaseId());
        courseBaseDTO.setAuditMind(auditVO.getAuditMind());
        courseBaseDTO.setAuditStatus(auditVO.getAuditStatus());
        courseBaseService.approveCourse(courseBaseDTO);
    }
}
